<?
/**
 * Handle password change.
 */
(basename($_SERVER['PHP_SELF']) == basename(__FILE__)) && die('Access Denied');

// title
$this->setTitle(WEB_APP_NAME . ' : Change Password');

/**
 * Are there errors?
 */
$hasErrors = (is_array($this->getErrors()) and count($this->getErrors()));

$this->addJs('js/menu.js');
?>
<?= $this->getPageHeader(); ?>
<? if ($hasErrors) { ?>
<div id="container-error">
<?= implode('<br />', $this->getErrors()); ?>
</div>
<? } ?>
<div align="center">
<div id="page-container">
<div id="container-medium">
<?= getMenuBarMain(OPT_PASSCHANGE); ?>

<div class="content-edit">
<?= $this->getFormHeader('passchangeForm'); ?>
<?= $this->getFormAction(ACTION_PASSCHANGE); ?>

<table align="center">
	<tr>
		<td colspan="2">
			Passwords must be at least <?= $this->getVar('minLength'); ?>
			characters and contain at least 1 character from each
			of the acceptable character types listed below:
		</td>
	</tr>
<? if ($this->getVar('requireLower')) { ?>
	<tr>
		<th>English lower case letters</th>
		<td>
			<?= htmlspecialchars(implode(' ', $this->getVar('pcLower'))); ?>
		</td>
	</tr>
<? } ?>
<? if ($this->getVar('requireUpper')) { ?>
	<tr>
		<th>English upper case letters</th>
		<td>
			<?= htmlspecialchars(implode(' ', $this->getVar('pcUpper'))); ?>
		</td>
	</tr>
<? } ?>
<? if ($this->getVar('requireNumber')) { ?>
	<tr>
		<th>Arabic numerals</th>
		<td>
			<?= htmlspecialchars(implode(' ', $this->getVar('pcNumber'))); ?>
		</td>
	</tr>
<? } ?>
<? if ($this->getVar('requireSpecial')) { ?>
	<tr>
		<th>Special characters</th>
		<td>
			<?= htmlspecialchars(implode(' ', $this->getVar('pcSpecial'))); ?>
		</td>
	</tr>
<? } ?>
	<tr>
		<th style="text-align: right">Password:</th>
		<td>
			<input type="password" name="<?= WA_QS_PASS1; ?>" size="40">
		</td>
	</tr>
	<tr>
		<th style="text-align: right">Again:</th>
		<td>
			<input type="password" name="<?= WA_QS_PASS2; ?>" size="40">
		</td>
	</tr>
	<tr>
		<td colspan="2" align="right">
			<input class="submit" type="submit" name="submit" value="Change Password">
		</td>
	</tr>
</table>
</form>

</div> <!-- content-edit -->

</div> <!-- container-medium -->
</div> <!-- pageContainer -->
</div> <!-- center -->
<script TYPE="text/javascript">
<!--
if (document.passchangeForm.<?= WA_QS_PASS1; ?>) {
	document.passchangeForm.<?= WA_QS_PASS1; ?>.focus();
	}
// -->
</script>
<?= $this->getPageFooter(); ?>
